<template>
  <view class="orders">
    <view class="top1">
      <uv-navbar title="全部评价" bgColor="#65c9bb" height="44px" @click="goback"
        titleStyle="{font-weight: bold;font-size: 1.1rem;}"></uv-navbar>
    </view>
    <!-- 头部 -->
    <view class="top">
      <uv-tabs :list="list" activeStyle="color: #eff7f7;text-align: center;padding: 20rpx;"
        inactiveStyle="color: black;background-color: #65c9bb;text-align: center; padding: 20rpx" lineWidth='0'
        @click="click" :scrollable="false"></uv-tabs>
    </view>
    <!-- 全部 -->
    <view v-if="current== 0" class="Mallorders">
      <view class="bottom" v-for="(item,index) in list1" :key="item.id">
        <view class="bottom-left">
          <uv-avatar src="/static/image/陈喜喜.jpg"></uv-avatar>
        </view>
        <view class="bottom-right">
          <view class="one">{{item.members_name}}</view>
          <view class="two">
            <uv-rate size="16px" :count="count" v-model="value1"></uv-rate>
            <view style="margin-left: 20rpx; color: #c1c1c1;">{{item.create_time}}</view>
          </view>
          <view class="three">{{item.text}}</view>
          <view class="four">
            <image src="/static/image/宠物医生.png" mode=""></image>
            <image src="/static/image/宠物医生.png" mode=""></image>
          </view>
        </view>
      </view>
    </view>
    <!-- 好评 -->
    <view v-if="current== 1" class="Mallorders">
      <view class="bottom" v-for="(item,index) in list2" :key="item.id">
        <view class="bottom-left">
          <uv-avatar src="/static/image/陈喜喜.jpg"></uv-avatar>
        </view>
        <view class="bottom-right">
          <view class="one">{{item.members_name}}</view>
          <view class="two">
            <uv-rate size="16px" :count="count" v-model="value1"></uv-rate>
            <view style="margin-left: 20rpx; color: #c1c1c1;">{{item.create_time}}</view>
          </view>
          <view class="three">{{item.text}}</view>
          <view class="four">
            <image src="/static/image/宠物医生.png" mode=""></image>
            <image src="/static/image/宠物医生.png" mode=""></image>
          </view>
        </view>
      </view>
    </view>
    <!-- 中评 -->
    <view v-if="current== 2" class="Mallorders">
      <view class="bottom" v-for="(item,index) in list3" :key="item.id">
        <view class="bottom-left">
          <uv-avatar src="/static/image/陈喜喜.jpg"></uv-avatar>
        </view>
        <view class="bottom-right">
          <view class="one">{{item.members_name}}</view>
          <view class="two">
            <uv-rate size="16px" :count="count" v-model="value1"></uv-rate>
            <view style="margin-left: 20rpx; color: #c1c1c1;">{{item.create_time}}</view>
          </view>
          <view class="three">{{item.text}}</view>
          <view class="four">
            <image src="/static/image/宠物医生.png" mode=""></image>
            <image src="/static/image/宠物医生.png" mode=""></image>
          </view>
        </view>
      </view>
    </view>
    <!-- 差评 -->
    <view v-if="current== 3" class="Mallorders">
      <view class="bottom" v-for="(item,index) in list4" :key="item.id">
        <view class="bottom-left">
          <uv-avatar src="/static/image/陈喜喜.jpg"></uv-avatar>
        </view>
        <view class="bottom-right">
          <view class="one">{{item.members_name}}</view>
          <view class="two">
            <uv-rate size="16px" :count="count" v-model="value1"></uv-rate>
            <view style="margin-left: 20rpx; color: #c1c1c1;">{{item.create_time}}</view>
          </view>
          <view class="three">{{item.text}}</view>
          <view class="four">
            <image src="/static/image/宠物医生.png" mode=""></image>
            <image src="/static/image/宠物医生.png" mode=""></image>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
  import {
    uniRequest
  } from "../../utils/request.js"
  export default {
    data() {
      return {
        count: 5,
        value1: '2',
        current: '',
        current1: '',
        list: [{
            name: '14万+ 全部',
          }, {
            name: '13万+ 好评',
          },
          {
            name: '1000+ 中评',
          },
          {
            name: '500+ 差评',
          },
        ],
        list1: '',
        list2: '',
        list3: '',
        list4: '',
      }
    },
    created() {
      const id1 = this.$route.query.id
      const id= id1.replace(/\"/g, "");
      console.log(id)
      const that = this
      // 全部
      uniRequest('master/index2?server=1', function(err, data) {
        if (err) {
          // 错误
          console.log(err)
        } else {
          console.log('"成功了"', data)
          that.list1 = data
          console.log('"list1"',that.list1)
        }
      }, 'POST', {
        id: id
      });
      // 好评
      uniRequest('apa/index1?server=1', function(err, data) {
        if (err) {
          // 错误
          console.log(err)
        } else {
          console.log('"list2成功了"', data)
          that.list2 = data
        }
      }, 'POST', {
        assess: '2',
        master_id: id,
        text: '好好好',
        images: '#'
      });
      // 中评
      uniRequest('apa/index2?server=1', function(err, data) {
        if (err) {
          // 错误
          console.log(err)
        } else {
          console.log('"list3成功了"', data)
          that.list3 = data
        }
      }, 'POST', {
        assess: '2',
        master_id: id,
        text: '好好好',
        images: '#'
      });
      // 差评
      uniRequest('apa/index3?server=1', function(err, data) {
        if (err) {
          // 错误
          console.log(err)
        } else {
          console.log('"list4成功了"', data)
          that.list4 = data
        }
      }, 'POST', {
        assess: '2',
        master_id: id,
        text: '好好好',
        images: '#'
      });
    },
    methods: {
      goback() {
        uni.navigateBack({
          delta: 1
        });
      },
      click(item) {
        this.current = item.index
        // console.log('item', item);
      },
    }
  }
</script>

<style lang="scss">
  @import url("evaluation.scss");
</style>